/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package upgmdendro.drawing.drawables;

import upgmdendro.drawing.*;
import java.awt.Point;

/**
 *
 * @author psychollek
 */
public class DrawableScale implements Drawable {

    private double[] values;

    public DrawableScale(double[] values) {
        this.values = values;
    }

    @Override
    public void paint() {

        int h = GraphicParameters.getHeight();

        (new DrawableLine(new Point(20, 20), new Point(20, h - 20))).paint();

        paintValue(0.0, 15);
        paintValue(1.0, 15);


        for (int i = 0; i < values.length; i++) {
            double d = values[i];
            paintValue(d, 10);
        }

    }

    private void paintValue(double d, int w) {
        int h = GraphicParameters.getHeight();
        (new DrawableLine(
                new Point(20, Math.round(Math.round(20 + ((h - 40) * d)))),
                new Point(20 + w, Math.round(Math.round(20 + ((h - 40) * d)))))).paint();
        (new DrawableText(
                Double.toString(d), 5,
                Math.round(Math.round(20 + ((h - 40) * d))))).paint();
    }
}
